package org.ezplatform.office.meeting.common.web.rest;

import javax.servlet.http.HttpServletRequest;

import org.ezplatform.cloud.common.controller.BaseController;
import org.ezplatform.core.web.view.OperationResult;
import org.ezplatform.office.meeting.setting.category.service.BoardroomCategorySetService;
import org.ezplatform.office.meeting.setting.serve.service.ServeSetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("api/meeting/meetingInit")
public class MeetingInitApiController extends BaseController {

	@Autowired
	private BoardroomCategorySetService boardroomCategorySetService;
	
	@Autowired
	private ServeSetService serveSetService;
	
    @ApiOperation(value = "", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "corpId", value = "单位id", required = true, paramType = "body", dataType = "String")
    })
    @RequestMapping(value = "/init", method = RequestMethod.GET)
    public OperationResult meetingInit(HttpServletRequest request) {
    	try {
    		String corpId = request.getParameter("corpId");
    		//boardroomCategorySetService.clearData(corpId);
    		this.boardroomCategorySetService.initData(corpId);
    		//serveSetService.clearData(corpId);
    		this.serveSetService.initData(corpId);
    	} catch (Exception e) {
    		e.printStackTrace();
    		return OperationResult.buildFailureResult("操作失败");
    	}
    	return OperationResult.buildSuccessResult("操作成功");
    }
    
    @ApiOperation(value = "", notes = "")
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "corpId", value = "单位id", required = true, paramType = "body", dataType = "String")
    })
    @RequestMapping(value = "/clear", method = RequestMethod.GET)
    public OperationResult meetingClear(HttpServletRequest request) {
    	try {
    		//String corpId = request.getParameter("corpId");
    		//boardroomCategorySetService.clearData(corpId);
    		//serveSetService.clearData(corpId);
    	} catch (Exception e) {
    		e.printStackTrace();
    		return OperationResult.buildFailureResult("操作失败");
    	}
    	return OperationResult.buildSuccessResult("操作成功");
    }
}